# coding=utf-8
import arcpy

path = r'D:\WorkData\20250712四川河流\0813处理'
arcpy.env.workspace = path
arcpy.env.overwriteOutput = True
spatial_ref = arcpy.SpatialReference(4326)
riv = r'D:\WorkData\20250712四川河流\0813处理\rivs.shp'.decode('utf-8')
lp = r'D:\WorkData\20250712四川河流\0813处理\p.shp'.decode('utf-8')

cs1 = arcpy.da.UpdateCursor(riv,['name','rivId','flowRiv','flowId'])
j = 0
for row1 in cs1:
    expression = "rivId = '{}'".format(row1[1])
    cs2 = arcpy.da.SearchCursor(lp,['rivId','n_riv_name','n_riv_id'],where_clause=expression)
    for row2 in cs2:
        print j,row1[1],row2[1],row2[2]
        row1[2] = row2[1]
        row1[3] = row2[2]
        cs1.updateRow(row1)
    cs2.reset()
    j+=1